package cc.atliberty.creating.simplefactory.simplefactory3;


/**
 * 简单工厂模式反射版测试
 */
public class Client {
    public static void main(String[] args) {
        String[] strs = {"grape", "strawberry", "apple"};
        for (String str : strs) {
            try {
                IFruit fruit = FruitGarden.factory(str);
                fruit.plant();
                fruit.harvest();
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
